Report post

Does sklearn have train_test_split under cross-validation?

Latest Stable release of sklearn 0.20.0 has train_test_split under model_selection not under cross_validation. sklearn keeps a release history of all its changes. Think of checking it from time to time. Here is the link to the documentation. As you can see in the documentation for the version 0.18, a new module was created called model_selection.

How to import a function in sklearn?

The format to import a function is : or you can import the entire module and call its function like: import sklearn.model_selection model_selection.train_test_split (params) import sklearn.model_selection as sk sk.train_test_split (params) There is an essential difference in what you are comparing.

Why is model_selection not working in sklearn?

As you can see in the documentation for the version 0.18, a new module was created called model_selection. Therefore it didn't exist in previous versions. Update sklearn and it will work ! Your sklearn version is too low, model_selection is imported by 0.18.1, so please update the sklearn version.

What is the difference between sklearn and alias?

import sklearn.model_selection as sk sk.train_test_split (params) There is an essential difference in what you are comparing. In the first line you are doing import function vs. second line from package import module as ALIAS. The first one is incorrect, you can import the module, but the function specifically.

The World's Leading Crypto Trading Platform

Get my welcome gifts